/**
 * 响应拦截
 * @param {Object} http 
 */
import store from '@/store/index.js'
import config from '@/config/index.js'
let isLock = false
module.exports = (vm) => {
	uni.$u.http.interceptors.response.use((response) => { /* 对响应成功做点什么 可使用async await 做异步操作*/
		if (response.data.code === '-200' && !response.config.url.includes('/usermanager/h5/userProject/') && !response.config.url.includes('/message/web/msg/listGroupByMsgType')) {
			
			if (!isLock) {
				uni.navigateTo({
					url: 'pages/login/login?isBack=1',
					success: function () {
						isLock = false
					}
				})
				uni.clearStorageSync()
			}
		} else {
			return Promise.reject(response);
		}
		return response
	}, (response) => { /*  对响应错误做点什么 （statusCode !== 200）*/
		return Promise.reject(response)
	})
}